package csu.jpetstore.jpetstore.exception;

import csu.jpetstore.jpetstore.result.Result;
import csu.jpetstore.jpetstore.result.ResultFactory;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class DefaultExceptionHandler {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result handleAuthorizationException(){
        String message = "权限认证失败";
        return ResultFactory.getOne(401,message,null);
    }
}
